package strategy_tasarim_sablonu;

import java.util.ResourceBundle;

public class FileManager {

	private Strategy strategy;

	public static final FileManager manager = new FileManager();

	private FileManager() {

		String strategy = ResourceBundle.getBundle(
				"" + "strategy").getString(
				"strategy");
		
		

		try {
			
			setStrategy(((Strategy)Class.forName(strategy).newInstance()));

		} catch (Exception e) {

			throw new RuntimeException(e);
		}

	}

	public static FileManager instance() {
       
		return manager;

	}

	public void setStrategy(Strategy strategy) {
		this.strategy = strategy;
	}

	public Strategy getStrategy() {
		return strategy;
	}

	public void saveBean(Bean bean) {

		getStrategy().save(bean);
	}

}
